{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 高维数据向低位数据映射 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "X = np.empty((100, 2))\n",
    "X[:,0] = np.random.uniform(0., 100., size=100)\n",
    "X[:,1] = 0.75 * X[:,0] + 3. + np.random.normal(0, 10., size=100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PCA(n_components=2)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from playML.PCA import PCA\n",
    "pca = PCA(n_components=2)\n",
    "pca.fit(X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.77421554,  0.63292204],\n",
       "       [-0.63291751,  0.77421924]])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pca.components_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PCA(n_components=1)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pca = PCA(n_components=1)\n",
    "pca.fit(X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(100, 1)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_reduction = pca.transform(X)\n",
    "X_reduction.shape             #降维"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(100, 2)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_restore = pca.inverse_transform(X_reduction)\n",
    "X_restore.shape               #恢复维度"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x3a1f09f908>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3de3Tb5Zng8e8rybLsJLblxIlDgnMjt5JVE+phwmVpCu0WhjZ0MmlPd3papmGHKTRD220OZVqYyR7abqcTptMeBlim7RSYWaB1PZB2egFSAtuGACEJakKSJuHi3O0kviS+yZbf/eORsKxItmzr8vvJz+ecHNuyLq8sePTqeZ/3eY21FqWUUu7jKfQAlFJKjY0GcKWUcikN4Eop5VIawJVSyqU0gCullEv58vlg06ZNs3Pnzs3nQyqllOu99tprp621NcmX5zWAz507lx07duTzIZVSyvWMMe+kulxTKEop5VIawJVSyqU0gCullEtpAFdKKZfSAK6UUi6V1yoUpZRyk3AYGhuhqQnq6mDNGgiFCj2qQToDV0qpFMJh2LQJWlth9mz5ummTXO4UGsCVUiqFxkYIBuWfxzP4fWNjoUc2SAO4Ukql0NQElZVDL6uslMudQgO4UkqlUFcH7e1DL2tvl8udQgO4UkqlsGaN5L1bW2FgYPD7NWsKPbJBGsCVUiqFUAg2bJC899Gj8nXDBmdVoWgZoVLKdfJV3hcKOStgJ9MZuFLKVdxQ3pcvGsCVUq7ihvK+fNEArpRyFTeU9+WLBnCllKu4obwvX3QRUynlKmvWSM4bZObd3i558FtuKey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BGdbaEyBBHpheuJGN2z8BdwIDsZ+nAm3W2v7Yz25/LecDLcC/xtJE3zfGTKKIXkNr7TFgE9CEBO524DWK63WMS/e65TQGFXsANykuK5q6SWPMZOCnwBettR2FHk+2GGM+AjRba19LvDjFVd38WvqAy4AHrbUrgE5cnC5JJZYHvgmYB1wETEJSCsnc/DqOJKf/3RZ7AD8KXJzw82zgeIHGklXGmBIkeP+7tbYxdvGp+Mez2NfmQo1vnK4CVhtj3kbSXtciM/Kq2EdxcP9reRQ4aq19OfZzAxLQi+U1BPgg8Ja1tsVa2wc0AldSXK9jXLrXLacxqNgD+KvAwtiqtx9ZQNlc4DGNWywf/ANgn7X2HxN+tRm4Ofb9zcDT+R5bNlhr/8ZaO9taOxd5zX5jrf0U8DywNnY11z4/AGvtSeCIMWZx7KLrgDcoktcwpglYaYwpj/03G3+ORfM6Jkj3um0GPhOrRlkJtMdTLVlhrS3qf8CfAH8ADgNfK/R4svScrkY+hoWB3bF/f4LkibcAB2Nfqws91iw811XAz2PfzwdeAQ4BPwFKCz2+cT635cCO2Ov4FBAsttcQ+F/AfmAP8BhQ6vbXEXgcyen3ITPsW9K9bkgK5Z9j8ef3SEVO1saiW+mVUsqlij2FopRSRUsDuFJKuZQGcKWUcikN4Eop5VIawJVSyqU0gCullEtpAFdKKZf6/8oP9ilyGKJ6AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X[:,0], X[:,1], color='b', alpha=0.5)\n",
    "plt.scatter(X_restore[:,0], X_restore[:,1], color='r', alpha=0.5)    #可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
